package com.hutao.sso.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
	
	private static SimpleDateFormat  dateFormat;
	
	/**
	 * 字符串转换为date
	 * @param format
	 * 			格式花样�?
	 * @param strDate
	 * 			时间字符�?
	 * @return
	 * @throws ParseException
	 */
	public static  Date strToDate(String format,String strDate) throws ParseException{
		dateFormat=new SimpleDateFormat(format);
		return dateFormat.parse(strDate);
		
	}
	
	public static String DateToStr(String format, Date date) throws Exception{
		dateFormat=new SimpleDateFormat(format);
		String strDate = dateFormat.format(date);
		return strDate;
	}


}
